<template>
    <div class="box7">
        <div class="title">
            <p>年度数据</p>
            <img src="../../images/dataScreen-title.png" alt="">
        </div>
        <div class="charts" ref="charts"></div>
    </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue'
import * as echarts from 'echarts'

// 获取charts节点
let charts = ref<any>()

onMounted(() => {
    // 获取charts类的实例
    let mycharts = echarts.init(charts.value)
    // 设置实例配置项
    mycharts.setOption({
        // 标题组件
        title: {
            text: '散点图',
            left: '40%',
            textStyle: {
                color: 'white'
            }
        },
        // x|y轴组件
        xAxis: {
            type: 'category',
            show: true
        },
        yAxis: {
            show: false
        },
        // 布局组件
        grid: {
            left: 20,
            right: 0,
            top: 20,
            bottom: 20
        },
        // 系列：决定展示什么样的图形
        series: [
            {
                type: 'scatter',
                data: [33, 88, 21, 9, 88, 234, 1213, 231, 6674, 3.88, 33, 21, 888, 3332, 2313, 123, 5, 657, 7],
                symbol: 'diamond',
                symbolSize:16,
                label:{
                    show:true,
                    position:'top',
                    color:'yellowgreen'
                },
                itemStyle:{
                    color:{
                        type: 'linear',
                        x: 0,
                        y: 0,
                        x2: 0,
                        y2: 1,
                        colorStops: [{
                            offset: 0, color: '#67563A'
                        }, {
                            offset: 1, color: '#10164A'
                        }],
                        global: false
                    }
                }
            },
        ],

    })
})
</script>

<style lang="scss" scoped>
.box7 {
    width: 100%;
    height: 100%;
    background: url('../../images/dataScreen-main-cb.png') no-repeat;
    background-size: 100% 100%;
    margin: 20px 0;

    .title {
        p {
            color: #fff;
            font-size: 18px;
        }
    }

    .charts {
        height: calc(100% - 30px);
    }
}
</style>